package com.object;

import org.newdawn.slick.Input;

public class InputController extends Controller {

    
    private Input input;

    public InputController(HeroSprite sprite, Input input) {
        super(sprite);
        this.input = input;
    }

    @Override
    public void control() {
        sprite.setMoving(true);
        if (input.isKeyDown(Input.KEY_DOWN)) {
            sprite.setPosicaoAtual(HeroPosition.FACE_DOWN);
        } else if (input.isKeyDown(Input.KEY_LEFT)) {
            sprite.setPosicaoAtual(HeroPosition.FACE_LEFT);
        } else if (input.isKeyDown(Input.KEY_RIGHT)) {
            sprite.setPosicaoAtual(HeroPosition.FACE_RIGHT);
        } else if (input.isKeyDown(Input.KEY_UP)) {
            sprite.setPosicaoAtual(HeroPosition.FACE_UP);
        } else {
            sprite.setMoving(false);
        }
    }
}
